#define _CRT_SECURE_NO_WARNINGS
#pragma once
#include "RBTree.h"

namespace bit
{

	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			K operator()(const pair<K, K>& p)
			{
				return p.first;
			}
		};
	public:
		typedef typename RBTree< K, pair<const K, K>, SetKeyOfT>::Iterator iterator;
		typedef typename RBTree< K, pair<const K, K>, SetKeyOfT>::ConstIterator const_iterator;

		pair<iterator, bool> insert(const K& key)
		{
			return _rbt.Insert(make_pair(key, key));
		}
		void inorder()
		{
			_rbt.InOrder();
		}
		iterator begin()
		{
			return _rbt.Begin();
		}
		iterator end()
		{

			return _rbt.End();
		}
		const_iterator begin()const
		{
			return _rbt.Begin();
		}
		const_iterator end()const
		{

			return _rbt.End();
		}
		//V& operator[](const K& key)
		//{
		//	pair<iterator, bool> ret = _rbt.Insert(make_pair(key, key));
		//	return ret.first->second;
		//}
	private:
		RBTree<K, pair<const K, K>, SetKeyOfT> _rbt;
	};
}